import { pinyin } from "pinyin-pro";
export const getFirstLetter = (str: string) => {
 
  let arr = pinyin(str, { toneType: "none", type: "array" })
  let letter = ''
  for(let item of arr){
    letter += item.charAt(0)
  }
  return letter
};

export const weatherImg = (str: string, lev: string) => {
    let letter = getFirstLetter(str)
    let map = {
        '蓝色': 'B',
        '橙色': 'O',
        '红色': 'H',
        '黄色': 'Y',
    }
    let a = map[lev]
    return `./weather/${letter}_${a}.png`
}
